import { Controller, Get, Post, Body, Patch, Param, Delete, UseInterceptors } from '@nestjs/common';
import { ReponseTestService } from './reponse-test.service';
import { CreateReponseTestDto } from './dto/create-reponse-test.dto';
import { UpdateReponseTestDto } from './dto/update-reponse-test.dto';
import { ResponseInterceptor } from '../../common/response'

/**
 * 测试响应拦截
 */
@Controller('reponse-test')
@UseInterceptors(new ResponseInterceptor()) // 整个模块添加
export class ReponseTestController {
  constructor(private readonly reponseTestService: ReponseTestService) { }

  @Post()
  create(@Body() createReponseTestDto: CreateReponseTestDto) {
    return this.reponseTestService.create(createReponseTestDto);
  }

  @Get()
  // @UseInterceptors(new ResponseInterceptor()) // 或者放单独的请求
  findAll() {
    return this.reponseTestService.findAll();
  }

  @Get(':id')
  findOne(@Param('id') id: string) {
    return this.reponseTestService.findOne(+id);
  }

}
